'use strict';
// https://www.qb5200.com/article/398353.html
const { pinyin } = require('pinyin-pro');
exports.main = async (event, context) => {
	const { text } = event;
	const yd = pinyin(text, {
		toneType: 'symbol',
		type: 'array'
	})
	const notyd = pinyin(text, {
		toneType: 'none',
		type: 'array'
	})
	const result = [];
	const textArr = text.split('');
	textArr.forEach((item, index) => {
		result.push({
			caption: item,
			display: yd[index].split(''),
			typing: notyd[index].split('')
		})
	})
	return {
		code: 0,
		data: result
	}
};